﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LibraryONTrack.UI
{
	public enum RecoveryAction
	{ RecoverDatabase, EraseDatabase };


	public partial class DatabaseCorruptDialog : Form
	{
		public RecoveryAction RecoveryAction 
		{
			get
			{
				return (RestoreDatabaseRadioButton.Checked ? RecoveryAction.RecoverDatabase : RecoveryAction.EraseDatabase);
			}			
		}
		public bool InstallSampleData 
		{
			get
			{
				return InstallSampleDataCheckBox.Checked;
			}		
		}

		public DatabaseCorruptDialog()
		{
			InitializeComponent();
			RestoreDatabaseRadioButton.Checked = true;
		}

		public DatabaseCorruptDialog(string errorMessage)
			: this()
		{
			ErrorMessageLabel.Text = errorMessage;
		}

		private void CreateDatabaseRadioButton_CheckedChanged(object sender, EventArgs e)
		{
			InstallSampleDataCheckBox.Enabled = CreateDatabaseRadioButton.Checked;
		}
	}
}
